package com.aifund.app.controller;

import com.aifund.app.entity.vo.user.MyInvitationVo;
import com.aifund.app.service.IncomeAndExpenditureService;
import com.aifund.common.result.ResultBody;
import com.aifund.common.util.JwtUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "收支明细")
@RequestMapping("/api/incomeAndExpenditure")
@RestController
public class IncomeAndExpenditureController {

    @Autowired
    IncomeAndExpenditureService incomeAndExpenditureService;
    @Autowired
    JwtUtil jwtUtil;

    @GetMapping("/myInvitation")
    @ApiOperation("我的邀请情况")
    public ResultBody<MyInvitationVo> myInvitation(HttpServletRequest request){
        MyInvitationVo invitationVo = incomeAndExpenditureService.myInvitation(jwtUtil.getUserId(request));
        return ResultBody.success(invitationVo);
    }





}
